<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org"
      th:replace="header" lang="en">
<div th:fragment="content">
    <style>
        .input-group{
            width: 100%;
        }
    </style>

    <div class="row">
        <div class="col-md-12">
            <div class="card form-horizontal">
                <div class="card-header bg-primary">
                    <h4  style="text-align: center;" th:text="${template.getTemplateName()}">任务模板名称</h4>
                </div>
                <div class="card-actions col-md-12 bg-primary p-lr-15 m-b-10" style="height: 32px;line-height: 32px;">
                    <span class="col-md-3" th:text="'姓名：'+${student.getSname()}">姓名：</span>
                    <span class="col-md-3" th:text="'学号：'+${student.getSno()}">学号：</span>
                    <span class="col-md-3" th:text="'学院：'+${student.getCollege()}">学院：</span>
                    <span class="col-md-3" th:text="'班级：'+${student.getCname()}">班级：</span>
                </div>
                <div class="card-body bg-white" style="height: 100%" th:utext="${template.getTemplateContext()}">
                    <!-- 填报内容 -->

                </div>
            </div>
        </div>
    </div>
    <script>

        function getReport(){
            let report = '';
            /*<![CDATA[*/
            report = '[[${report}]]';
            /*]]>*/

            // text_7497955debab56d334aea8ef856b6e10=%E5%84%BF%E7%AB%A5%E4%BA%BA%E6%A0%BC%E4%BA%BA%E6%A0%BC%E8%AE%A9%E4%BB%96&amp;text_f451b7943ca78bf0be08c2dd4a1c2292=v%E6%89%8D%E5%8F%91%E7%8E%B0%E8%93%84%E5%8A%BF%E5%BE%85%E5%8F%91%E6%95%A3%E7%83%AD&amp;text_ac7732afd5e6df7f3e3ca373c3fbc401=%E5%8D%B4%E6%97%A0%E4%BA%BA%E5%8F%8D%E5%AF%B9%E6%88%91&amp;text_7f0abcda657bebc6c3f83ddff6e0ac48=%E6%97%A0%E6%B3%95%E8%AE%A9&amp;text_5b9bbb793093c2e966c9aee3789d4e6e=%E8%80%8C%E9%9D%9E%E8%AE%A9%E6%88%91%E5%8E%BB&amp;text_c8707d14e225de26e1a9ae535a4f6468=%E4%BA%8C%E7%BB%B4%E6%97%A5+%C2%B7&amp;textarea_e3871188898a8f097ae8fa3f2f21b5c2=&amp;number_1220e947cd00a583ab8624c5d4c91c24=
            let $report = [];
            $.each(report.split("&amp;"), function (i, r) {
                let re = r.split("=")
                $report.push({"key":re[0], "value":re[1]});
                console.log(re[0] + '====>'+ decodeURI(re[1]))
                $("input[name="+re[0]+"]").val(decodeURI(re[1]));
            })
            console.log($report);
        }

        $(document).ready(function () {
            // 读取填报数据
            getReport();

            // 移除生成的onclick
            $("div").removeAttr("onclick");

            // 禁用输入框
            $("input").attr("disabled", true)
            $("textarea").attr("disabled", true)

        })
    </script>
</div>
</html>